package com.wmx.main;

import com.wmx.entity.MyCallable;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @author:wmx 2025-03-11 19:08
 * 1、功能:
 * 2、参数{
 * <p>
 * <p>
 * }
 **/
public class entrance {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
//        五、编写程序，使用多线程，实现电影院售票的过程。
//              （使用两种方法实现）
//        1、多个线程各自卖自己的50张票 -- 继承 Thread

        MyCallable myCallable = new MyCallable();
        FutureTask<String> futureTask1 = new FutureTask<>(myCallable);
        FutureTask<String> futureTask2 = new FutureTask<>(myCallable);
        Thread thread1 = new Thread(futureTask1, "电影院A");
        Thread thread2 = new Thread(futureTask2, "电影院B");
        thread1.start();
        thread1.join();
        thread2.start();


    }
}
